<template>
  <div class="content-box">
    <div class="scroll-view-box">
      <el-button class="history-btn" @click="hisDrawer = true" size="small">历史记录</el-button>
      <div class="data-box-left" ref="databoxleft" v-if="dataObj">
        <div class="user-title-box" v-if="$fieldShowFunc('42-xmxx')">项目信息</div>
        <el-descriptions class="margin-bottom" :column="3" border>
          <el-descriptions-item label="项目名称" v-if="$fieldShowFunc('js_xmmc')">
            <div class="justify_8" slot="label">项目名称</div>
            {{ dataObj.project_name || '--' }}
          </el-descriptions-item>
          <el-descriptions-item label="项目编号" v-if="$fieldShowFunc('js_xmbh')">
            <div class="justify_8" slot="label">项目编号</div>
            <el-button @click="goToProjectFunc" type="text" style="padding: 0;">{{ dataObj.project_number || '--'
            }}</el-button>
          </el-descriptions-item>
          <el-descriptions-item label="项目品牌" v-if="$fieldShowFunc('js_xmpp')">
            <div class="justify_8" slot="label">项目品牌</div>
            {{ dataObj.brand_name || '--' }}
          </el-descriptions-item>
          <el-descriptions-item label="项目类型" v-if="$fieldShowFunc('js_xmlx')">
            <div class="justify_8" slot="label">项目类型</div>
            {{ dataObj.store_type_name || '--' }}
          </el-descriptions-item>
          <el-descriptions-item labelClassName="descriptions_opacity" contentClassName="descriptions_opacity"
            v-for="key in $fieldRowFunc(3, 1, 0)" :key="key"></el-descriptions-item>
        </el-descriptions>
        <div class="user-title-box" v-if="$fieldShowFunc('42-jsxx')">结算信息</div>
        <el-descriptions class="margin-bottom" :column="3" border>

          <el-descriptions-item label="结算单状态" v-if="$fieldShowFunc('js_jsdzt')">
            <div class="justify_8" slot="label">结算单状态</div>
            <span v-if="dataObj.settlement_status == 1">待出具</span>
            <span v-if="dataObj.settlement_status == 2"> 出具中 </span>
            <span v-if="dataObj.settlement_status == 3">已完成</span>
          </el-descriptions-item>
          <el-descriptions-item label="实际完工日期" v-if="$fieldShowFunc('js_sjwgrq')">
            <div class="justify_8" slot="label">实际完工日期</div>
            {{ dataObj.actual_completion_date || '--' }}
          </el-descriptions-item>
          <el-descriptions-item label="出具结算单时间" v-if="$fieldShowFunc('js_cjjsdsj')">
            <div class="justify_8" slot="label">出具结算单时间</div>
            {{ dataObj.settlement_start_date || '--' }}
          </el-descriptions-item>
          <el-descriptions-item label="结算单时效" v-if="$fieldShowFunc('js_jsdsx')">
            <div class="justify_8" slot="label">结算单时效</div>
            {{ dataObj.settlement_doc_validity ? dataObj.settlement_doc_validity + '天' : '--' }}
          </el-descriptions-item>
          <el-descriptions-item label="结算完成时间" v-if="$fieldShowFunc('js_jswcsj')">
            <div class="justify_8" slot="label">结算完成时间</div>
            {{ dataObj.settlement_completion_date || '--' }}
          </el-descriptions-item>
          <el-descriptions-item label="结算时效" v-if="$fieldShowFunc('js_jssx')">
            <div class="justify_8" slot="label">结算时效</div>
            {{ dataObj.settlement_validity ? dataObj.settlement_validity + '天' : '--' }}
          </el-descriptions-item>
          <el-descriptions-item label="应结算金额" v-if="$fieldShowFunc('js_yjsje')">
            <div class="justify_8" slot="label">应结算金额</div>
            <el-popover placement="bottom-end" trigger="manual" :value="jsbjPrice" :width="width31" :offset="10"
              popper-class="price-popover" transition="el-zoom-in-top">
              <el-descriptions :column="1" direction="horizontal" border>
                <el-descriptions-item label="签约金额" :labelStyle="{ background: '#fff', border: 'none' }"
                  :contentStyle="{ border: 'none' }" v-if="$fieldShowFunc('js_qyje')">
                  <div class="justify_8" slot="label">签约金额</div>
                  {{ dataObj.contract_price || dataObj.contract_price == 0 ? dataObj.contract_price + '元' : '--' }}
                </el-descriptions-item>
                <el-descriptions-item label="增减项总额" :labelStyle="{ background: '#fff', border: 'none' }"
                  :contentStyle="{ border: 'none' }" v-if="$fieldShowFunc('js_zxjze')">
                  <div class="justify_8" slot="label">增减项总额</div>
                  {{ dataObj.changes_amount || dataObj.changes_amount == 0 ? dataObj.changes_amount + '元' : '--' }}
                </el-descriptions-item>
              </el-descriptions>
              <div class="item-box" @click="openClick('jsbjPrice')" slot="reference">
                <span class="title">
                  {{ dataObj.settlement_amount ? dataObj.settlement_amount + '元' : '--' }}
                </span>
                <i :class="jsbjPrice ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
                  v-if="$fieldShowFunc('js_qyje') || $fieldShowFunc('js_zxjze')"></i>
              </div>
            </el-popover>
          </el-descriptions-item>

          <el-descriptions-item label="实际结算金额" v-if="$fieldShowFunc('js_sjjsje')">
            <div class="justify_8" slot="label">实际结算金额</div>
            {{ dataObj.actual_settlement_amount ? dataObj.actual_settlement_amount + '元' : '--' }}
          </el-descriptions-item>
          <el-descriptions-item label="结算优惠金额" v-if="$fieldShowFunc('js_jsyhje')">
            <div class="justify_8" slot="label">结算优惠金额</div>
            {{ dataObj.settlement_discount_amount + '' ? dataObj.settlement_discount_amount + '元' : '--' }}
          </el-descriptions-item>

          <el-descriptions-item label="项目最终利润金额" v-if="$fieldShowFunc('js_xmzzlrje')">
            <div class="justify_8" slot="label">项目最终利润金额</div>
            {{ dataObj.final_discount_amount ? dataObj.final_discount_amount + '元' : '--' }}
          </el-descriptions-item>
          <el-descriptions-item label="最终成本利润率" v-if="$fieldShowFunc('js_zzcblrje')">
            <div class="justify_8" slot="label">最终成本利润率</div>
            {{ dataObj.final_cost_profit ? dataObj.final_cost_profit + '%' : '--' }}
          </el-descriptions-item>
          <el-descriptions-item label="成本金额" v-if="$fieldShowFunc('js_cbje')">
            <div class="justify_8" slot="label">成本金额</div>
            <el-popover placement="bottom-end" trigger="manual" :value="cbjePrice" :width="width31" :offset="10"
              popper-class="price-popover" transition="el-zoom-in-top">
              <el-descriptions :column="1" direction="horizontal" border>
                <el-descriptions-item label="现场采购成本" :labelStyle="{ background: '#fff', border: 'none' }"
                  :contentStyle="{ border: 'none' }" v-if="$fieldShowFunc('js_xccgcb')">
                  <div class="justify_8" slot="label">现场采购成本</div>
                  {{ dataObj.procurement_cost ? dataObj.procurement_cost + '元' : '--' }}
                </el-descriptions-item>
                <el-descriptions-item label="公司集采成本" :labelStyle="{ background: '#fff', border: 'none' }"
                  :contentStyle="{ border: 'none' }" v-if="$fieldShowFunc('js_gscjcb')">
                  <div class="justify_8" slot="label">公司集采成本</div>
                  {{ dataObj.centralized_procurement_cost ? dataObj.centralized_procurement_cost + '元' : '--' }}
                </el-descriptions-item>
                <el-descriptions-item label="管理成本" :labelStyle="{ background: '#fff', border: 'none' }"
                  :contentStyle="{ border: 'none' }" v-if="$fieldShowFunc('js_glcb')">
                  <div class="justify_8" slot="label">管理成本</div>
                  {{ dataObj.management_costs ? dataObj.management_costs + '元' : '--' }}
                </el-descriptions-item>
              </el-descriptions>

              <div class="item-box" @click="openClick('cbjePrice')" slot="reference"
                v-if="$fieldShowFunc('js_xccgcb') || $fieldShowFunc('js_gscjcb') || $fieldShowFunc('js_glcb')">
                <span class="title">
                  {{ dataObj.settlement_cost_amount ? dataObj.settlement_cost_amount + '元' : '--' }}
                </span>
                <i :class="cbjePrice ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></i>
              </div>
              <div v-else slot="reference">
                <span class="title">
                  {{ dataObj.settlement_cost_amount ? dataObj.settlement_cost_amount + '元' : '--' }}
                </span>
              </div>
            </el-popover>
          </el-descriptions-item>
          <el-descriptions-item label="利润金额" v-if="$fieldShowFunc('js_lrje')">
            <div class="justify_8" slot="label">利润金额</div>
            {{ dataObj.profit_amount ? dataObj.profit_amount + '元' : '--' }}
          </el-descriptions-item>
          <el-descriptions-item label="成本利润率" v-if="$fieldShowFunc('js_cblrl')">
            <div class="justify_8" slot="label">成本利润率</div>
            {{ dataObj.settlement_profit_margin ? dataObj.settlement_profit_margin + '%' : '--' }}
          </el-descriptions-item>
          <el-descriptions-item label="结算备注" v-if="$fieldShowFunc('js_jsbz')">
            <div class="justify_8" slot="label">结算备注</div>
            {{ dataObj.remark || '--' }}
          </el-descriptions-item>
          <el-descriptions-item label="结算单" v-if="$fieldShowFunc('js_jsd')">
            <div class="justify_8" slot="label">结算单</div>
            <div class="file-box-img-box flex a" v-if="dataObj.settlement_file.length">
              <div class="file-box-img" v-for="(item, index) in dataObj.settlement_file" :key="index"
                @click="$fileViewHandle(item)">
                <el-tooltip class="item" effect="dark" :content="item.file_name" placement="top">
                  <img @click="$fileViewHandle(item)" class="img" :src="$fileImgFunc(item)" />
                </el-tooltip>
              </div>
            </div>
            <span v-if="!dataObj.settlement_file.length">--</span>
          </el-descriptions-item>
          <el-descriptions-item label="结算成本单" v-if="$fieldShowFunc('js_cbd')">
            <div class="justify_8" slot="label">结算成本单</div>
            <div class="file-box-img-box flex a" v-if="dataObj.profit_statement_file.length">
              <div class="file-box-img" v-for="(item, index) in dataObj.profit_statement_file" :key="index"
                @click="$fileViewHandle(item)">
                <el-tooltip class="item" effect="dark" :content="item.file_name" placement="top">
                  <img @click="$fileViewHandle(item)" class="img" :src="$fileImgFunc(item)" />
                </el-tooltip>
              </div>
            </div>
            <span v-if="!dataObj.profit_statement_file.length">--</span>
          </el-descriptions-item>
          <el-descriptions-item label="结算利润单" v-if="$fieldShowFunc('js_jsgclqd')">
            <div class="justify_8" slot="label">结算利润单</div>
            <div class="file-box-img-box flex a" v-if="dataObj.inventory_file.length">
              <div class="file-box-img" v-for="(item, index) in dataObj.inventory_file" :key="index"
                @click="$fileViewHandle(item)">
                <el-tooltip class="item" effect="dark" :content="item.file_name" placement="top">
                  <img @click="$fileViewHandle(item)" class="img" :src="$fileImgFunc(item)" />
                </el-tooltip>
              </div>
            </div>
            <span v-if="!dataObj.inventory_file.length">--</span>
          </el-descriptions-item>
          <el-descriptions-item label="项目已收款" v-if="$fieldShowFunc('js_xmysk')">
            <div class="justify_8" slot="label">项目已收款</div>
            {{ dataObj.paid_amount + '' ? dataObj.paid_amount + '元' : '--' }}
          </el-descriptions-item>
          <el-descriptions-item label="项目未收款" v-if="$fieldShowFunc('js_xmwsk')">
            <div class="justify_8" slot="label">项目未收款</div>
            {{ dataObj.unpaid_amount + '' ? dataObj.unpaid_amount + '元' : '--' }}
          </el-descriptions-item>
          <el-descriptions-item label="创建时间" v-if="$fieldShowFunc('js_cjsj')">
            <div class="justify_8" slot="label">创建时间</div>
            {{ dataObj.created_at || '--' }}
          </el-descriptions-item>
          <el-descriptions-item labelClassName="descriptions_opacity" contentClassName="descriptions_opacity"
            v-for="key in $fieldRowFunc(3, 1, 1)" :key="key"></el-descriptions-item>
        </el-descriptions>
      </div>

    </div>
    <!-- 审核区域 -->
    <div class="examine-box" v-if="isExamine">
      <div class="examine-title">审核区域</div>
      <el-form :model="shjsdRuleForm" ref="shjsdRuleForm" label-position="top">
        <el-form-item label="" prop="reviewPassed">
          <el-radio-group v-model="shjsdRuleForm.reviewPassed" size="small">
            <el-radio :label="1">通过</el-radio>
            <el-radio :label="2">拒绝</el-radio>
          </el-radio-group>
        </el-form-item>

        <!--  v-if="shjsdRuleForm.reviewPassed == 2" -->
        <el-form-item label="" prop="remark">
          <el-input :rows="4" class="input-box" placeholder="审批意见" v-model="shjsdRuleForm.remark"
            type="textarea"></el-input>
        </el-form-item>
        <el-form-item>
          <div class="form-btn">
            <el-button type="primary" @click="shjsdSubmit" :loading="diaLoading">提交</el-button>
          </div>
        </el-form-item>
      </el-form>
    </div>

    <!-- 历史弹窗 -->
    <el-drawer @close="hisDrawer = false" title="历史记录" :visible.sync="hisDrawer" :with-header="false" size="600px">
      <div class="right-box">
        <div class="title-box flex ac fw" style="margin: 20px 0 0 10px">历史记录</div>
        <el-empty style="margin-top: 150px" description="无数据" v-if="!logList.length"></el-empty>
        <el-timeline class="timeline">
          <el-timeline-item v-for="(item, index) in logList" :key="index">
            <div class="setp-box">
              <div class="setp-top flex ac jb">
                <p class="time">{{ item.updated_at || '' }}</p>
                <div class="user-box flex ac">
                  <img class="avater" :src="item.handlers_image" />
                  {{ item.handlers_name + "-" + item.handlers_position }}
                </div>
              </div>
              <div class="setp-content">
                <div class="title">
                  {{ item.content }}
                </div>
                <!-- 拒绝理由item.log_status == 390 -->
                <!-- 审核通过item.log_status == 400 -->
                <template v-if="item.log_status != 380 && item.log_status != 410">
                  <div class="content-table">
                    <div class="flex jb fw">
                      <div class="table-item width-50">
                        <span class="table-item-title history_justify_6">审批意见</span>
                        <span class="table-item-content">{{ item.form_data.remark || '--' }}</span>
                      </div>
                    </div>
                  </div>
                </template>
                <!-- 提交尾款凭证 -->
                <template v-if="item.log_status == 410">
                  <div class="content-table">
                    <div class="flex jb fw">
                      <div class="table-item width-50" v-if="$fieldShowFunc('js_js_sklx')">
                        <span class="table-item-title history_justify_6">收款类型</span>
                        <span class="table-item-content">{{ item.form_data.payment_name || '--' }}</span>
                      </div>
                      <div class="table-item width-50" v-if="$fieldShowFunc('js_skzh')">
                        <span class="table-item-title history_justify_6">收款账户</span>
                        <span class="table-item-content">{{ item.form_data.account_name || '--' }}</span>
                      </div>
                      <div class="table-item" v-if="$fieldShowFunc('js_skje')">
                        <span class="table-item-title history_justify_6">收款金额</span>
                        <span class="table-item-content">{{
                          item.form_data.amount_collected ? item.form_data.amount_collected + '元' : '--' }}</span>
                      </div>
                      <div class="table-item fw width-50" v-if="$fieldShowFunc('js_jsd')">
                        <div class="table-item-title history_justify_6">结算单</div>
                        <div class="img-list-box flex ac fw">
                          <template v-for="(file, index) in item.form_data.payment_voucher">
                            <el-tooltip class="item" effect="dark" :content="file.file_name"
                              placement="top">
                              <img @click="$fileViewHandle(file)" :key="index" class="img" :src="$fileImgFunc(file)" />
                            </el-tooltip>
                          </template>
                        </div>
                      </div>
                    </div>
                  </div>
                </template>
                <!-- 出局结算单 -->
                <template v-if="item.log_status == 380">
                  <div class="content-table">
                    <div class="flex jb fw">
                      <div class="table-item width-50" v-if="$fieldShowFunc('js_yjsje')">
                        <span class="table-item-title history_justify_6">应结算金额</span>
                        <span class="table-item-content">
                          {{ item.form_data.settlement_amount ? item.form_data.settlement_amount + '元' : '--' }}
                        </span>
                      </div>
                      <div class="table-item width-50" v-if="$fieldShowFunc('js_zzlrje')">
                        <span class="table-item-title history_justify_6">利润金额</span>
                        <span class="table-item-content">{{ item.form_data.profit_amount ?
                          item.form_data.profit_amount + '元' : '--' }}</span>
                      </div>
                      <div class="table-item width-50" v-if="$fieldShowFunc('js_zzcblrl')">
                        <span class="table-item-title history_justify_6">成本利润率</span>
                        <span class="table-item-content">{{ item.form_data.settlement_profit_margin ?
                          item.form_data.settlement_profit_margin + '%' : '--' }}</span>
                      </div>
                      <div class="table-item width-50" v-if="$fieldShowFunc('js_jsbjje')">
                        <span class="table-item-title history_justify_6">结算报价金额</span>
                        <span class="table-item-content">{{ item.form_data.settlement_quotation_amount ?
                          item.form_data.settlement_quotation_amount + '元' : '--' }}</span>
                      </div>
                      <div class="table-item width-50" v-if="$fieldShowFunc('js_jczxf')">
                        <span class="table-item-title history_justify_6">基础装修费</span>
                        <span class="table-item-content">{{ item.form_data.settlement_basic_decoration_fee ?
                          item.form_data.settlement_basic_decoration_fee + '元' : '--' }}</span>
                      </div>
                      <div class="table-item width-50" v-if="$fieldShowFunc('js_zccgf')">
                        <span class="table-item-title history_justify_6">主材采购费</span>
                        <span class="table-item-content">{{ item.form_data.settlement_material_costs ?
                          item.form_data.settlement_material_costs + '元' : '--' }}</span>
                      </div>
                      <div class="table-item width-50" v-if="$fieldShowFunc('js_sj')">
                        <span class="table-item-title history_justify_6">税金</span>
                        <span class="table-item-content">{{ item.form_data.settlement_taxes ?
                          item.form_data.settlement_taxes + '元' : '--' }}</span>
                      </div>
                      <div class="table-item width-50" v-if="$fieldShowFunc('js_cbje')">
                        <span class="table-item-title history_justify_6">成本金额</span>
                        <span class="table-item-content">{{ item.form_data.settlement_cost_amount ?
                          item.form_data.settlement_cost_amount + '元' : '--' }}</span>
                      </div>
                      <div class="table-item width-50" v-if="$fieldShowFunc('js_xccgcb')">
                        <span class="table-item-title history_justify_6">现场采购成本</span>
                        <span class="table-item-content">{{ item.form_data.procurement_cost ?
                          item.form_data.procurement_cost + '元' : '--' }}</span>
                      </div>
                      <div class="table-item width-50" v-if="$fieldShowFunc('js_gscjcb')">
                        <span class="table-item-title history_justify_6">公司集采成本</span>
                        <span class="table-item-content">{{ item.form_data.centralized_procurement_cost ?
                          item.form_data.centralized_procurement_cost + '元' : '--' }}</span>
                      </div>
                      <div class="table-item width-50" v-if="$fieldShowFunc('js_glcb')">
                        <span class="table-item-title history_justify_6">管理成本</span>
                        <span class="table-item-content">{{ item.form_data.management_costs ?
                          item.form_data.management_costs + '元' : '--' }}</span>
                      </div>
                      <div class="table-item width-50" v-if="$fieldShowFunc('js_lrje')">
                        <span class="table-item-title history_justify_6">利润金额</span>
                        <span class="table-item-content">{{ item.form_data.profit_amount ?
                          item.form_data.profit_amount + '元' : '--' }}</span>
                      </div>
                      <div class="table-item width-50" v-if="$fieldShowFunc('js_cblrl')">
                        <span class="table-item-title history_justify_6">成本利润率</span>
                        <span class="table-item-content">{{ item.form_data.settlement_profit_margin ?
                          item.form_data.settlement_profit_margin + '%' : '--' }}</span>
                      </div>
                      <div class="table-item" v-if="$fieldShowFunc('js_jsbz')">
                        <span class="table-item-title history_justify_6">结算备注</span>
                        <span class="table-item-content">{{ item.form_data.remark || '--' }}</span>
                      </div>
                      <div class="table-item fw width-50" v-if="$fieldShowFunc('js_jsd')">
                        <div class="table-item-title history_justify_6">结算单</div>
                        <div class="img-list-box flex ac fw">
                          <template v-for="(file, index) in item.form_data.settlement_file">
                            <el-tooltip class="item" effect="dark" :content="file.file_name"
                              placement="top">
                              <img @click="$fileViewHandle(file)" :key="index" class="img" :src="$fileImgFunc(file)" />
                            </el-tooltip>
                          </template>
                        </div>
                      </div>
                      <div class="table-item fw width-50" v-if="$fieldShowFunc('js_cbd')">
                        <div class="table-item-title history_justify_6">结算成本单</div>
                        <div class="img-list-box flex ac fw">
                          <template v-for="(file, index) in item.form_data.profit_statement_file">
                            <el-tooltip class="item" effect="dark" :content="file.file_name"
                              placement="top">
                              <img @click="$fileViewHandle(file)" :key="index" class="img" :src="$fileImgFunc(file)" />
                            </el-tooltip>
                          </template>
                        </div>
                      </div>
                      <div class="table-item fw width-50" v-if="$fieldShowFunc('js_jsgclqd')">
                        <div class="table-item-title history_justify_6">结算利润单</div>
                        <div class="img-list-box flex ac fw">
                          <template v-for="(file, index) in item.form_data.inventory_file">
                            <el-tooltip class="item" effect="dark" :content="file.file_name"
                              placement="top">
                              <img @click="$fileViewHandle(file)" :key="index" class="img" :src="$fileImgFunc(file)" />
                            </el-tooltip>
                          </template>
                        </div>
                      </div>
                    </div>
                  </div>
                </template>
              </div>
            </div>
          </el-timeline-item>
        </el-timeline>
      </div>
    </el-drawer>
  </div>
</template>
<script>
import preSettlementApi from '@/api/preSettlementApi';
import { getUserInfo } from '@/utils/auth';
import projectApi from "@/api/projectApi";
import * as math from "mathjs";

export default {
  name: 'settlemenDetailPage',
  data() {
    return {
      // 审核
      userInfo: {},
      shjsdRuleForm: {
        remark: "",
        reviewPassed: 1,
      },
      diaLoading: false,
      isExamine: false,


      jsbjPrice: false,
      cbjePrice: false,
      logList: [],
      dataObj: '',
      hisDrawer: false,

      width31: 0,
    };
  },
  computed: {

  },
  mounted() {
    window.addEventListener('resize', () => {
      this.jsbjPrice = false
      this.cbjePrice = false
    });
    this.isExamine = this.$route.query.examine || false;
    this.userInfo = getUserInfo();
    this.getSettlementDetails();
  },
  methods: {
    openClick(field) {
      this.width31 = (this.$refs['databoxleft'].clientWidth / 3) - 3
      this[field] = !this[field]
    },
    getSettlementDetails() {
      if (!this.$route.query.id) return;
      preSettlementApi.getSettlementDetails({
        project_id: this.$route.query.id
      }).then(res => {
        console.log(res, "结算详情")
        if (res.code == 200) {
          res.data.log_list.forEach(item => {
            item.form_data = item.form_data ? JSON.parse(item.form_data) : item.form_data;
          });
          this.logList = res.data.log_list || [];
          this.dataObj = res.data;
          console.log(this.logList, "日志")
        }
      })
    },
    shjsdSubmit(formName) {
      let shjsdRuleForm = this.shjsdRuleForm;
      if (shjsdRuleForm.reviewPassed == 2) {
        if (!shjsdRuleForm.remark) {
          this.$message({
            type: "warning",
            message: "请填写审批意见"
          });
          return;
        }
        this.diaLoading = true;
        projectApi
          .settlementStatementRejected({
            project_id: this.$route.query.id,
            remark: shjsdRuleForm.remark,
          })
          .then((res) => {
            console.log(res, "审核结算单");
            this.diaLoading = false;
            if (res.code == 200) {
              this.getSettlementDetails();
              this.isExamine = false;
              this.$router.push({
                path: '/settlemenDetailPage', query: {
                  id: this.$route.query.id
                }
              })
            }
            this.$message({
              type: res.code == 200 ? "success" : "warning",
              message: res.code == 200 ? "处理成功" : res.message,
            });
          })
          .catch((err) => {
            this.diaLoading = false;
            this.$message({
              type: "warning",
              message: err.message,
            });
          });
        return;
      }
      let audit_type = 1;
      if (this.dataObj.engineering_manager_review != 2) {
        audit_type = 1;
      }
      if (this.dataObj.engineering_manager_review == 2 && this.dataObj.cost_supervisor_review != 2) {
        audit_type = 2;
      }
      projectApi
        .settlementStatementPassed({
          project_id: this.$route.query.id,
          remark: shjsdRuleForm.remark,
          audit_type//: this.userInfo.position_id == 7 ? 1 : 2
        })
        .then((res) => {
          console.log(res, "审核结算单");
          this.diaLoading = false;
          if (res.code == 200) {
            this.getSettlementDetails();
            this.isExamine = false;
            this.$router.push({
              path: '/settlemenDetailPage', query: {
                id: this.$route.query.id
              }
            })
          }
          this.$message({
            type: res.code == 200 ? "success" : "warning",
            message: res.code == 200 ? "处理成功" : res.message,
          });
        })
        .catch((err) => {
          this.diaLoading = false;
          this.$message({
            type: "warning",
            message: err.message,
          });
        });
    },
    // 去项目详情
    goToProjectFunc() {
      this.$store.commit('isEventTriggeredFunc', true);
      this.$router.push({
        path: '/projectDetailNew',
        query: {
          id: this.dataObj.id
        }
      })
    },
  },
};
</script>
<style lang="scss" scoped>
@import '@/styles/detail.scss';
</style>
<style lang="scss">
.labelClassName {
  width: 160px;
  background: #f5f8fe !important;
  text-align: center !important;
  padding: 0 !important;
  line-height: 1 !important;
}

.contentClassName {
  font-weight: 400 !important;
  font-size: 17px !important;
  color: #1b2431 !important;
  padding-left: 20px !important;
}

.labelClassName2 {
  width: 160px;
  background: rgba(0, 0, 0, 0) !important;
  text-align: center !important;
  padding: 0 !important;
  line-height: 1 !important;
  border: none !important;
  border-left: 1px solid #eff2f8 !important;
}

.contentClassName2 {
  font-weight: 400 !important;
  font-size: 17px !important;
  color: #1b2431 !important;
  padding-left: 20px !important;
  border: none !important;
  border: none !important;
  border-right: 1px solid #eff2f8 !important;
}
</style>